import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/sys/dictionary/base/list',
    method: 'get',
    params: query
  })
}

export function fetchAll(query) {
  return request({
    url: '/sys/dictionary/base/all',
    method: 'get',
    params: query
  })
}

export function fetchDictionary(id) {
  return request({
    url: '/sys/dictionary/base/one',
    method: 'get',
    params: { id }
  })
}

export function createDictionary(data) {
  return request({
    url: '/sys/dictionary/base',
    method: 'post',
    data
  })
}

export function updateDictionary(data) {
  return request({
    url: '/sys/dictionary/base',
    method: 'put',
    data
  })
}

export function createOrupdateDictionary(data) {
  return request({
    url: '/sys/dictionary/base/save-or-update',
    method: 'post',
    data
  })
}

export function deleteDictionary(id) {
  return request({
    url: '/sys/dictionary/base/' + id,
    method: 'delete'
  })
}

export function fetchVersion() {
  return request({
    url: '/sys/dictionary/version',
    method: 'get'
  })
}
